package compilers.AST.statement;

import java.util.Iterator;
import java.util.LinkedList;

import compilers.AST.Node;
import compilers.AST.basics.Identifier;
import compilers.AST.basics.Parameter;
import compilers.AST.types.TypeSpecifier;
import compilers.exceptions.SemanticalException;
import compilers.symbolTable.SymbolTableElement;
import compilers.symbolTable.SymbolTableScope;

public class FunctionDeclarationStatement extends Statement {
	
	private TypeSpecifier fReturnType;
	private Identifier fIdentifier;
	private LinkedList<Parameter> fParameters;

	public FunctionDeclarationStatement() {
		fParameters = new LinkedList<Parameter>();
	}
	
	public FunctionDeclarationStatement(int lineNr) {
		super(lineNr);
		fParameters = new LinkedList<Parameter>();
	}
	
	public void print(int identLevel) {
		println(identLevel, "FunctionDeclarationStatement");
		fReturnType.print(identLevel+1);
		fIdentifier.print(identLevel+1);
		Iterator<Parameter> it = fParameters.iterator();
		while (it.hasNext()) {
			it.next().print(identLevel+1);
		}
	}
	
	public void setReturnType(TypeSpecifier returnType) {
		fReturnType = returnType;
	}
	
	public void setIdentifier(Identifier ident) {
		fIdentifier = ident;
	}
	
	public void addParameter(Parameter param) {
		fParameters.add(param);
	}
	
	public LinkedList<Parameter> getParameters() {
		return fParameters;
	}
	
	public void checkSemantics(Node root, SymbolTableScope currentScope) throws SemanticalException {
	}

}
